# ~*~ coding: utf-8 ~*~

from apps.blueprints import codes_blueprint

from .views import EnvironmentListAPI, EnvironmentListView, \
    EnvironmentCreateView, EnvironmentUpdateView, EnvironmentDeleteView
from .views import ProjectListAPI, ProjectListView, \
    ProjectCreateView, ProjectUpdateView, ProjectDeleteView, ProjectItemAPI, ProjectPermissionView
from .views import TaskListAPI, TaskListView, TaskCreateView, TaskDeployView, \
    TaskRollbackView, TaskDeleteView, TaskAuditAPI, TaskAuditView, TaskAuditApprovalAPI, TaskAuditRefuseAPI
from .views import FilterListAPI, FilterListView, FilterCreateView, FilterUpdateView, FilterDeleteView
from .views import LabelListAPI, LabelListView, LabelCreateView, LabelUpdateView, LabelDeleteView

# environment
codes_blueprint.add_url_rule('/api/environment/', view_func=EnvironmentListAPI.as_view('api-environment-list'))
codes_blueprint.add_url_rule('/environment/', view_func=EnvironmentListView.as_view('environment-list'))
codes_blueprint.add_url_rule('/environment/create/', view_func=EnvironmentCreateView.as_view('environment-create'))
codes_blueprint.add_url_rule('/environment/<uuid:pk>/update/',
                             view_func=EnvironmentUpdateView.as_view('environment-update'))
codes_blueprint.add_url_rule('/environment/<uuid:pk>/delete/',
                             view_func=EnvironmentDeleteView.as_view('environment-delete'))

# project
codes_blueprint.add_url_rule('/api/project/', view_func=ProjectListAPI.as_view('api-project-list'))
codes_blueprint.add_url_rule('/api/project/<uuid:pk>/item/', view_func=ProjectItemAPI.as_view('api-project-item'))
codes_blueprint.add_url_rule('/project/', view_func=ProjectListView.as_view('project-list'))
codes_blueprint.add_url_rule('/project/create/', view_func=ProjectCreateView.as_view('project-create'))
codes_blueprint.add_url_rule('/project/<uuid:pk>/update/',
                             view_func=ProjectUpdateView.as_view('project-update'))
codes_blueprint.add_url_rule('/project/<uuid:pk>/delete/',
                             view_func=ProjectDeleteView.as_view('project-delete'))
codes_blueprint.add_url_rule('/project/<uuid:pk>/permission/',
                             view_func=ProjectPermissionView.as_view('project-permission'))

# task
codes_blueprint.add_url_rule('/api/task/', view_func=TaskListAPI.as_view('api-task-list'))
codes_blueprint.add_url_rule('/task/', view_func=TaskListView.as_view('task-list'))
codes_blueprint.add_url_rule('/task/create/', view_func=TaskCreateView.as_view('task-create'))
codes_blueprint.add_url_rule('/task/<uuid:pk>/deploy/',
                             view_func=TaskDeployView.as_view('task-deploy'))
codes_blueprint.add_url_rule('/task/<uuid:pk>/rollback/',
                             view_func=TaskRollbackView.as_view('task-rollback'))
codes_blueprint.add_url_rule('/task/<uuid:pk>/delete/',
                             view_func=TaskDeleteView.as_view('task-delete'))
# audit
codes_blueprint.add_url_rule('/api/audit/', view_func=TaskAuditAPI.as_view('api-audit-list'))
codes_blueprint.add_url_rule('/audit/', view_func=TaskAuditView.as_view('audit-list'))
codes_blueprint.add_url_rule('/audit/<uuid:pk>/approval/',
                             view_func=TaskAuditApprovalAPI.as_view('audit-approval'))
codes_blueprint.add_url_rule('/audit/<uuid:pk>/refuse/',
                             view_func=TaskAuditRefuseAPI.as_view('audit-refuse'))

# filter
codes_blueprint.add_url_rule('/api/filter/', view_func=FilterListAPI.as_view('api-filter-list'))
codes_blueprint.add_url_rule('/filter/', view_func=FilterListView.as_view('filter-list'))
codes_blueprint.add_url_rule('/filter/create/', view_func=FilterCreateView.as_view('filter-create'))
codes_blueprint.add_url_rule('/filter/<uuid:pk>/update/',
                             view_func=FilterUpdateView.as_view('filter-update'))
codes_blueprint.add_url_rule('/filter/<uuid:pk>/delete/',
                             view_func=FilterDeleteView.as_view('filter-delete'))

# label
codes_blueprint.add_url_rule('/api/label/', view_func=LabelListAPI.as_view('api-label-list'))
codes_blueprint.add_url_rule('/label/', view_func=LabelListView.as_view('label-list'))
codes_blueprint.add_url_rule('/label/create/', view_func=LabelCreateView.as_view('label-create'))
codes_blueprint.add_url_rule('/label/<uuid:pk>/update/',
                             view_func=LabelUpdateView.as_view('label-update'))
codes_blueprint.add_url_rule('/label/<uuid:pk>/delete/',
                             view_func=LabelDeleteView.as_view('label-delete'))
